﻿using GameFramework.DataTable;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TowerDefence_Zombie.Data;

namespace TowerDefence_Zombie
{
    public sealed class SiginRewardData
    {
        private DRSiginReward dRSiginReward;

        public int Id
        {
            get
            {
                return dRSiginReward.Id;
            }
        }

        public int MoneyId
        {
            get
            {
                return dRSiginReward.MoneyId;
            }
        }

        public int MoneyNum
        {
            get
            {
                return dRSiginReward.MoneyNum;
            }
        }

        public string MoneyIconRes
        {
            get
            {
                return dRSiginReward.ResIcon;
            }
        }
      
        public SiginRewardData(DRSiginReward drSiginReward)
        {
            this.dRSiginReward = drSiginReward;
        }
    }

    public sealed class SystemData : DataBase
    {
        private IDataTable<DRSiginReward> dtSiginReward;
        public List<SiginRewardData> SiginRewardList;

        protected override void OnInit()
        {

        }

        protected override void OnPreload()
        {
            LoadDataTable("SiginReward");
        }


        protected override void OnLoad()
        {
            dtSiginReward = GameEntry.DataTable.GetDataTable<DRSiginReward>();
            if (dtSiginReward == null)
                throw new System.Exception("Can not get data table PoolParam");

            SiginRewardList = new();

            DRSiginReward[] dRSiginRewards = dtSiginReward.GetAllDataRows();
            foreach (var dRSiginReward in dRSiginRewards)
            {
                SiginRewardData poolParamData = new(dRSiginReward);
                SiginRewardList.Add(poolParamData);
            }
        }
        public List<SiginRewardData> GetSiginRewardList()
        {
            return SiginRewardList;
        }
        protected override void OnUnload()
        {
            GameEntry.DataTable.DestroyDataTable<DRSiginReward>();
            SiginRewardList = null;
        }


        protected override void OnShutdown()
        {
        }
    }
}
